// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者，助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件，未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import request from '@/plugins/request';

/**
 * @description 直播列表
 */
export function liveList(params) {
    return request({
        url: 'cloud_live/room/list',
        method: 'get',
        params
    });
}

/**
 * @description 直播列表
 */
export function liveAdd(data) {
    return request({
        url: 'cloud_live/room/add',
        method: 'post',
        data
    });
}

/**
 * @description 直播列表详情
 */
export function liveDetail(id) {
    return request({
        url: 'cloud_live/room/detail/' + id,
        method: 'get',
    });
}


/**
 * @description 直播间设置是否显示
 */
export function liveShow(id, type) {
    return request({
        url: `cloud_live/room/set_show/${id}/${type}`,
        method: 'get',
    });
}

/**
 * @description 直播商品列表
 */
export function liveGoods(params) {
    return request({
        url: 'cloud_live/goods/list',
        method: 'get',
        params
    });
}
/**
 * @description 删除商品列表
 */
export function liveGoodsDel(params) {
    return request({
        url: 'cloud_live/goods/delete',
        method: 'delete',
        params
    });
}
/**
 * @description 直播商品列表生成直播商品
 */
export function liveGoodsCreat(data) {
    return request({
        url: 'cloud_live/goods/create',
        method: 'post',
        data
    });
}

/**
 * @description 直播商品列表添加
 */
export function liveGoodsAdd(data) {
    return request({
        url: 'cloud_live/goods/add',
        method: 'post',
        data
    });
}

/**
 * @description 直播间添加商品
 */
export function liveRoomGoodsAdd(data) {
    return request({
        url: 'live/room/add_goods',
        method: 'post',
        data
    });
}

/**
 * @description 直播商品详情
 */
export function liveGoodsDetail(id) {
    return request({
        url: 'cloud_live/goods/detail/' + id,
        method: 'get',
    });
}

/**
 * @description 直播商品显示
 */
export function liveGoodsShow(id, type) {
    return request({
        url: `cloud_live/goods/set_show/${id}/${type}`,
        method: 'get',
    });
}

/**
 * @description 直播商品管理-- 分类
 */
export function treeListApi(type) {
    return request({
        url: `cloud_live/category/tree/${type}`,
        method: 'get'
    });
}

/**
 * @description 直播商品管理-- 热门推荐
 */
export function goodsSetHot(id, is_hot) {
    return request({
        url: `cloud_live/goods/set_hot/${id}/${is_hot}`,
        method: 'get'
    });
}

/**
 * @description 销售排行
 */
export function getSaleRanking(params) {
    return request({
        url: 'cloud_live/sale/get_sale_ranking',
        method: 'get',
        params
    });
}

/**
 * @description 大屏数据统计
 */
export function getStatistics(params) {
    return request({
        url: 'cloud_live/sale/statistics',
        method: 'get',
        params
    });
}